<?php

class PrivilegeInfoService extends Service{

    function __construct() {
        parent::__construct();
        $this->mDao = new PrivilegeInfoDao();
    }

    public function insertObject($obj){
        try {
            return $this->mDao->insertObject($obj);
        } catch (Exception $exc) {
            PageData::addModelError($exc->getMessage());
            throw new Exception($exc->getMessage());
        }
    }

    public function updateObject($obj,$oldId){
        try {
            return $this->mDao->updateObject($obj,$oldId);
        } catch (Exception $exc) {
            PageData::addModelError($exc->getMessage());
            throw new Exception($exc->getMessage());
        }
    }

    public function getList() {
        try {
            return $this->mDao->getList();
        } catch (Exception $exc) {
            PageData::addModelError($exc->getMessage());
            throw new Exception($exc->getMessage());
        }
    }
    
    public function getObject($id){
        try {
            return $this->mDao->getObject($id);
        } catch (Exception $exc) {
            PageData::addModelError($exc->getMessage());
            throw new Exception($exc->getMessage());
        }
    }

    public function deleteObject($id){
        try {
            return $this->mDao->deleteObject($id);
        } catch (Exception $exc) {
            PageData::addModelError($exc->getMessage());
            throw new Exception($exc->getMessage());
        }
    }
    
    public function getPrivilegeInfoByGroupId($groupId){
        try {
            return $this->mDao->getListByGroupId($groupId);
        } catch (Exception $exc) {
            PageData::addModelError($exc->getMessage());
            throw new Exception($exc->getMessage());
        }
    }
    
    public function updateGroupId($groupId,$oldGroupId){
        try {
            return $this->mDao->updateGroupId($groupId,$oldGroupId);
        } catch (Exception $exc) {
            PageData::addModelError($exc->getMessage());
            throw new Exception($exc->getMessage());
        }
    }
}
